<script>

function solution(str) {
  return [...str.replace(/[^a-zA-Z]/g, '').toLowerCase()]
    .map(c => c.charCodeAt(0) - 'a'.charCodeAt(0) + 1)
    .join(' ')
}

console.log(solution("The sunset sets at twelve o' clock."))

</script>